<!DOCTYPE html>
<html>
  <head>
    <title>this的使用</title>
	
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <script type="text/javascript">
		//<![CDATA[
			function WhoAmI(){
				//不被引用的情况时this是根对象window
				//this.name = "window";
				document.write("<h1>I'm is " + this.name + " of " + typeof(this) + " / " + this + ".");
			}
			WhoAmI();		
			
			//Adam
			var Adam = {
				name: "Adam Yu",
				WhoAmI: WhoAmI
			}
			//this就是Adam
			Adam.WhoAmI();
			
			//Yukee: 写法等同于Adam
			var Yukee = {name: "Yukee Liu"};
			Yukee.WhoAmI = WhoAmI;
			Yukee.WhoAmI();
			
			WhoAmI.call(Adam);
			WhoAmI.call(Yukee);
			
			//将Adam作为this，调用Yukee的成员方法（此处用“属性”更恰当）
			Yukee.WhoAmI.call(Adam);
			
			WhoAmI.name = "WhoAmI";
			WhoAmI.WhoAmI = WhoAmI;
			WhoAmI.WhoAmI();
			
			//匿名
			({
				name: "Hello",
				WhoAmI: WhoAmI
			}).WhoAmI();
		//]]>
    </script>
  </head>
  
  <body>
  </body>
</html>
